#
# Makefile to make the file libclientserver.a, containing
# connection.o and server.o
#

CXX		 = g++
#CXXFLAGS	 = -ggdb  -Wall -W -Werror -pedantic-errors
#CXXFLAGS	+= -Wmissing-braces -Wparentheses
# The following option cannot be used since some of the socket
# macros give warnings on "old-style-cast"
CXXFLAGS	+= 


BIN		= ../bin/
SRC	= $(wildcard *.cc)

.PHONY: all move

all: newsserver_mem.out newsserver_disk.out newsclient.out move

# Create the library; ranlib is for Darwin and maybe other systems.
# Doesn't seem to do any damage on other systems.

newsserver_disk.out: newsserver_disk.o newsserver.o connection.o\
	server.o drivedatabase.o messagehandler.o 
	$(CXX) -o $@ $^

newsserver_mem.out: newsserver_ram.o newsserver.o connection.o\
	server.o memdatabase.o messagehandler.o 
	$(CXX) -o $@ $^

newsclient.out:	newsclient.o connection.o messagehandler.o
	$(CXX) -o $@ $^

move:	
	mv *.o* $(BIN)

%.d: %.cc
	@set -e; rm -f $@; \
	 $(CXX) -MM $(CPPFLAGS) $< > $@.$$$$; \
	 sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \
	 rm -f $@.$$$$

include $(SRC:.cc=.d)
